package com.biz.primus.ms.promotion.service.feign;

import com.biz.primus.base.exception.utils.AssertUtils;
import com.biz.primus.base.vo.member.MemberInfoVo;
import com.biz.primus.model.promotion.exception.PromotionExceptionType;
import com.biz.primus.ms.promotion.feign.MemberFeignClient;
import java.util.Objects;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * MemberFeignService
 *
 * @author david-liu
 */
@Service
public class MemberFeignService {

    @Autowired(required = false)
    private MemberFeignClient memberFeignClient;

    public MemberInfoVo getMemberInfo(Long memberId) {
        if (Objects.isNull(memberId)) {
            return null;
        }
        MemberInfoVo memberInfo = memberFeignClient.getMemberInfo(memberId);
        AssertUtils.notNull(memberInfo, PromotionExceptionType.MEMBER_INTO_PROMOTION_JUDGING_NOT_EXIST);
        return memberInfo;
    }
}
